package crystal.workshop.io;

import java.io.File;

/**
 * Stores information about a structure file on the local disk.
 * @author Martin Uhrin
 *
 */
public class LocalDiskStructureInfo {
	
	/** The structure file */
	private File structureFile;
	/** The time that the file was last read from disk */
	private long lastRead;
	/** The number of references to this file i.e. the number of times the file
	 * has been loaded.  When the reference count drops to zero it will be
	 * unloaded.
	 */
	private int referenceCount = 1;
	
	public File getStructureFile() {
		return structureFile;
	}
	
	public long getLastRead() {
		return lastRead;
	}
	
	void setLastRead( final long lastRead ) {
		this.lastRead = lastRead;
	}
	
	int increaseReferenceCount() { return ++referenceCount; }
	
	int decreaseReferenceCount() {return --referenceCount; }
	
	LocalDiskStructureInfo( final File structureFile, final long lastRead ) {
		this.structureFile	= structureFile;
		this.lastRead		= lastRead;
	}
}